/* NAVIGATION VISIBLE ON SCROLL */

$(document).ready(function () {
    mainNav();

});

$(window).scroll(function () {
    mainNav();
	
});

if (matchMedia('(min-width: 992px), (max-width: 767px)').matches) {
  function mainNav() {
        var top = (document.documentElement && document.documentElement.scrollTop) || document.body.scrollTop;
        if (top > 40){
			$('.sticky-navigation').stop().animate({"top": '0'});
			
		}

        else $('.sticky-navigation').stop().animate({"top": '0'});
    }
}

if (matchMedia('(min-width: 768px) and (max-width: 991px)').matches) {
  function mainNav() {
        var top = (document.documentElement && document.documentElement.scrollTop) || document.body.scrollTop;
        if (top > 40) $('.sticky-navigation').stop().animate({"top": '0'});

        else $('.sticky-navigation').stop().animate({"top": '0'});
    }
}
